package com.szy.news.activity;

import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;

public class SmallBodyActivity extends Activity implements OnClickListener {
	
	private ImageView iv;
	private Button btn_login;
	private Button btn_backhome;
	private Button btn_play;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_smallbody);
		//动画占用组件
		iv = (ImageView) findViewById(R.id.imageView1);
		//动画播放按钮
		btn_play = (Button) findViewById(R.id.btn_play);
		btn_play.setOnClickListener(this);
		//返回主界面
		btn_backhome = (Button) findViewById(R.id.btn_backhome);
		btn_backhome.setOnClickListener(this);
		//登录
//		btn_login = (Button) findViewById(R.id.btn_login);
//		btn_login.setOnClickListener(this);
	}
//	public void play(View v){
//		iv.setBackgroundResource(R.drawable.frame_anim);
//		AnimationDrawable anim = (AnimationDrawable) iv.getBackground();
//		anim.start();
//	}

	@Override
	public void onClick(View v) {
		int id = v.getId();
		Intent intent;
		if(id == R.id.btn_backhome){
			intent = new Intent();
			intent.setClass(SmallBodyActivity.this, MainActivity.class);
			startActivity(intent);
			this.finish();
		}
		else if(id == R.id.btn_play){
			iv.setBackgroundResource(R.drawable.frame_anim);
			AnimationDrawable anim = (AnimationDrawable) iv.getBackground();
			anim.start();
		}
//		else if(id == R.id.btn_login){
//			intent = new Intent();
//			intent.setClass(this, LoginActivity.class);
//			startActivity(intent);
//			finish();
//		}
	}
	
}
